package cj.web.yc.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.yc.domain.PointLog;

/**
 * 
 * @author 
 *
 */
@DAO
public interface PointLogDAO{
	
	@SQL("SELECT * FROM PointLog WHERE 1=1 #if(:t.code != null){ AND code LIKE '%##(:t.code)%' } ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<PointLog> query(@SQLParam("t") PointLog pointLog);
		
	@SQL("SELECT count(1) FROM PointLog WHERE 1=1 #if(:t.code != null){ AND code LIKE '%##(:t.code)%' }" )
    int querySize(@SQLParam("t") PointLog pointLog);
    
    @SQL("SELECT * FROM PointLog WHERE id=:1")
    PointLog queryById(int id);
    
    @SQL("INSERT INTO PointLog ("
			        		+ "memberId,"
			        		+ "code,"
			        		+ "pointNum,"
			        		+ "createAt"
							+") VALUES ("
							+ ":t.memberId,"
							+ ":t.code,"
							+ ":t.pointNum,"
							+ "now()"
					+")")
    void create(@SQLParam("t") PointLog pointLog);
	
    @SQL("UPDATE PointLog SET deleteFlag=0 WHERE id=:1")
    void deleteById(int id);
}